package com.egrid.point.bury.entity;

import com.sun.org.apache.bcel.internal.generic.RETURN;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.util.List;

/**
 * OrderInfo.java
 * Created at 2022-09-30
 * Created by Royal Warmer
 * Copyright (C) 2022  BMW BRILLIANCE AUTOMOTIVE, All rights reserved.
 */
@Data
public class OrderInfo {

    private String orderDate;

    private String orderUrl;

    private String orderId;

    private String paymentType;

    private List<OrderItem> orderItems;

    @Data
    public static class OrderItem implements Serializable {

        private String productName;
        private String deliveryDate;
        private String trackingNumber;

        private String trackingType;


        public String getTrackingType() {
           if (!StringUtils.isEmpty(trackingNumber)) {
               if (trackingNumber.startsWith("SF")) {
                   return "顺丰";
               }

               if (trackingNumber.startsWith("EZ")) {
                   return "邮政";
               }
           }
           return null;
        }
    }

}
